﻿using System;
using System.Collections.Generic;
using System.Text;
using Demo.Controllers;
using System.IO;
using yq.IBase.DBHelper;
using System.Threading;
using System.Threading.Tasks;
using System.Data;
using yq.IBase.Basis;
using yq.IBase;
using yq.Business;
using cn.Util;
using yq.Model.Logic;
using yq.CacheHelp;
using ClassLibrary1;
namespace ConsoleApplication1
{
    
    class Program
    {
        static void Main2(string[] args)
        {
            for (; ; )
            {
               

                Action ac = () =>
                {
                    yq.GetService.Create<Itool>().add(1,1);
                };

                CodeTime.RunTime(ac
                         , 0, "test0");


                Action aca = () =>
                {
                    yq.GetService.Create<Itool>().add(1,1);
                };

                CodeTime.RunTime(aca
                         , 0, "test1");


         


           



                Console.ReadLine();
            }
        }


        static void Main(string[] args)
        {
       
            for (; ; )
            {

                //Action acd = () =>
                //{
                //    Func<DbHelper, CaCheRefresh, string> doFun = (cn, cha) =>
                //    {


                //        var list = new LogUserDal().Add(new LogUser() {  Ip = "1", LogTime = DateTime.Now, Other = "1", UserId = "1" }, cn);
                //        return "";
                //    };
                //    new DbExec().DoTrans(doFun);
                //};

                //CodeTime.RunTime(acd
                //      , 1, "test");


                
                Action ac = () =>
                {
                    Func<DbHelper, string> doFun = (cn) =>
                    {
                        var list = new LogUserDal().Where(obj => obj.Ip == "1").OderByDesc(obj=>obj.LogTime).ToList(cn,1);

                        //new LogUserDal().Advance(obj => obj.UserAccount,list,cn);

                        return "";
                    };
                    new DbExec().DoRead(doFun);
                };

                CodeTime.RunTime(ac
                      , 1, "直接插入");

           

                Console.ReadLine();
            }
        }


        static void Main44444444444(string[] args)
        {



            for (; ; )
            {

                //Action aca = () =>
                //{
                //    using(DbHelper cn=new DbHelper ())
                //    {
                //       var comm = cn.GetSqlStringCommond(" select * From Log_User t where t.ip = @ip    ");
                //       cn.AddInParameter(comm, "@ip", DbType.String, "1");
                //       var list = new LogUser().GetIList(cn.ExecuteDataTable(comm));
                    
                //    }
                //};
                //CodeTime.RunTime(aca
                //      , 1, "基本查询");


                //Action ac = () =>
                //{

                //    Func<DbHelper, string> doFun = (cn) =>
                //    {
                //        var comm = cn.GetSqlStringCommond(" select * From Log_User t where t.ip = @ip    ");
                //        cn.AddInParameter(comm, "@ip", DbType.String, "1");
                //        var list = new LogUser().GetIList(cn.ExecuteDataTable(comm));
                //         return "";
                //    };
                //     DbExec.DoRead(doFun);
                //};


                //CodeTime.RunTime(ac
                //       , 1, "直接查询");




                Action acd = () =>
                {

                    Func<DbHelper,string> doFun = (cn) =>
                    {
                        new LogUserDal().Where(obj => obj.LogId == "ddcb050ee8a04773927a83ffcd33b5ee").ToModel(cn);
                         return "";
                    };

                   new DbExec().DoRead(doFun);
                };


                CodeTime.RunTime(acd
                       , 1, "反射查询");

                Console.ReadLine();
            }

























                // 
            //Action<DbHelper, ICaCheRefresh> doFun=(cn,cache)=>
            //{

            //    var model = new LogUserDal().Where(obj => obj.LogId == "3c3d81f7af3841f3a5a030f8d08a512f").ToModel(cn);
            //    model.UserId = "test1";
            //    new LogUserDal().Update(model, cn);

            //    var pageList = new LogUserDal().Where().OderBy(obj => obj.LogTime).ToPageList(new PageModel() { PageSize = 1 }, cn);

            //    var ddd = 1;
            //};


           // DbExec.DoTrans(doFun);

            //using (DbHelper cn = new DbHelper())
            //{
            //    var dd = new LogUserDal().Where(obj => obj.Ip == "1").ToList(cn);

            //    new LogUserDal().Advance(obj => obj.UserAccount, dd, cn);

            //    var dd2 = new UserAccountDal().GetAllList(cn);
            //}

            //PageList<UserAccount> page = new PageList<UserAccount>();
            // List<UserAccount> pageList = new List<UserAccount>();
          
            //var BASE = new ConsoleApplication1.abc.abcBase();
             //List<abc> dd = new List<abc>();
             ///BASE.Advance(obj => obj.b, dd, new DbHelper());


           

        }

    }
}
